package com.example.module.jump;

import android.util.SparseArray;

import com.example.common.jump.ActivityId;
import com.example.common.jump.ActivityStruct;
import com.example.module.ModuleMainActivity;
import com.example.module.ModuleSecondActivity;
import com.example.module.ModuleThirdActivity;

/**
 * 用来储存所有的Activity实例
 */


public class ModuleActivityMapping {
	private static final ModuleActivityMapping INSTANCE = new ModuleActivityMapping();
	private SparseArray<ActivityStruct> sparseArray = new SparseArray<>();

	public static ModuleActivityMapping getinstance() {
		return ModuleActivityMapping.INSTANCE;
	}


	private ModuleActivityMapping() {
		sparseArray.put(ActivityId.MODULE_MAIN, new ActivityStruct("module主页面", ModuleMainActivity.class));
		sparseArray.put(ActivityId.MODULE_SECOND, new ActivityStruct("module二级页面", ModuleSecondActivity.class));
		sparseArray.put(ActivityId.MODULE_THIRD, new ActivityStruct("module三级页面", ModuleThirdActivity.class));
	}

	public ActivityStruct getActivityStruct(int activityId) {
		if (null == sparseArray) {
			sparseArray = new SparseArray<>();
		}
		return sparseArray.get(activityId, new ActivityStruct("主页面", null));
	}

}
